package edu.rit.drh4818.volume;

/**
 * A colormap converts integers to colors.
 * 
 * @author Darren Headrick
 *
 */
public abstract class Colormap 
{

    protected int[] colorMapping = new int[ 256 ];
    
    /**
     * Get the mapping for a single value.
     * @param x
     * @return
     */
    public int getColorMapping( int x )
    {
    	if( colorMapping == null )
    		return 0;
    	
    	if( x >= colorMapping.length ) 
    		return colorMapping[ 255 ];
    	if( x < 0 ) return colorMapping[0];
    	
    	return colorMapping[x];
    }
}
